(() => {
  // 设置字体大小
  function calcFontSize() {
    const zoom = window.screen.width / 1920;
    const size = zoom * 16;
    document.documentElement.style.fontSize = size + 'px';
  }
  // window.onload:网页加载完成之后立刻执行
  window.onload = () => {
    calcFontSize();
    let resize_timer = null;
    const resize = () => {
      if (resize_timer) {
        clearTimeout(resize_timer);
      }
      resize_timer = setTimeout(() => {
        resize_timer = null;
        calcFontSize();
      }, 500)
    };
    window.onresize = resize;
  }
})();